import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';

import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { HeaderComponent } from './header/header.component';
import { MenuComponent } from './header/menu/menu.component';
import { StudentListComponent } from './container/student-list/student-list.component';
import { FormsModule } from '@angular/forms';
import { SearchComponent } from './header/search/search.component';
import { StudentComponent } from './container/student-list/student/student.component';
import { FilterSexyComponent } from './container/student-list/filter-sexy/filter-sexy.component';
import { StudentDetailComponent } from './container/student-detail/student-detail.component';
import { StudentFootComponent } from './container/student-list/student-foot/student-foot.component';
import { StudentListFootComponent } from './container/student-list/student-list-foot/student-list-foot.component';
import { SetbackgroundDirective } from './mydirective/setbackground.directive';
import { HighlightstudentDirective } from './mydirective/highlightstudent.directive';
import { DisabledstudentDirective } from './mydirective/disabledstudent.directive';
import { ButtonDynamicClassDirective } from './mydirective/buttondynamicclass.directive';
import { ButtonDynamicClass2Directive } from './mydirective/buttondynamicclass2.directive';
import { CustomStyleDirective } from './mydirective/CustomStyle.directive';
import { CustomNgForDirective } from './mydirective/customngfor.directive';
import { UserListComponent } from './usersystem/usermanager/userlist/user-list.component';
import { UserLoginComponent } from './usersystem/userlogin/user-login.component';
import { UserDetailComponent } from './usersystem/usermanager/userdetail/user-detail.component';
import { UsermanagerComponent } from './usersystem/usermanager/usermanager.component';
import { ReactiveFormsModule } from '@angular/forms';
import { HttpClientModule, HTTP_INTERCEPTORS } from '@angular/common/http';
import { HttpInterceptorService } from './http/http-interceptor.service';
import { USERInjectionToken } from './service/user.token';
import { UserService } from './service/user.service';
import { SidebarComponent } from './usersystem/sidebar/sidebar.component';
@NgModule({
  declarations: [
    AppComponent,
    HeaderComponent,
    MenuComponent,
    StudentListComponent,
    SearchComponent,
    StudentComponent,
    FilterSexyComponent,
    StudentDetailComponent,
    StudentFootComponent,
    StudentListFootComponent,
    // 自定义指令
    SetbackgroundDirective,
    HighlightstudentDirective,
    DisabledstudentDirective,
    ButtonDynamicClassDirective,
    ButtonDynamicClass2Directive,
    CustomStyleDirective,
    CustomNgForDirective,
    UserListComponent,
    UserLoginComponent,
    UserDetailComponent,
    UsermanagerComponent,
    SidebarComponent
  ],
  imports: [
    BrowserModule,
    AppRoutingModule,
    FormsModule,
    HttpClientModule,
    ReactiveFormsModule

  ],
  providers: [
    { provide: HTTP_INTERCEPTORS, useClass: HttpInterceptorService, multi: true },
    {
      provide: USERInjectionToken,
      useValue: localStorage.getItem('user') ? JSON.parse(localStorage.getItem('user') as string) : null
    }],
  bootstrap: [AppComponent]
})
export class AppModule { }
